<?php
//企业展示站首页
namespace App\Http\Controllers\Enterprise;

use App\Http\Controllers\AdapterWebController;
use App\Modules\Article\ApiArticle;
use App\Modules\Article\ApiArticleClassify;
use App\Models\Article\Article;
use Illuminate\Http\Request;

class Home extends AdapterWebController
{
    //首页
    public function index(Request $request)
    {
        //新闻中心下的分类
        $postData['pid'] = 5;
        $classlist = $this->appLayerExec(ApiArticleClassify::class, 'assignClass', $postData);

        //所有文章列表
        $list = $this->appLayerExec(ApiArticle::class, 'allList');
        return view('enterprise.index',['classlist'=>$classlist['res'],'list'=>$list['res']]);

    }
    //关于我们
    public function aboutUs(Request $request)
    {
        //关于我们的文章列表
        $postData['cid'] = 2;
        $list = $this->appLayerExec(ApiArticle::class, 'articleList', $postData);
        return view('enterprise.aboutUs',['list'=>$list['res']]);

    }
    //产品中心（货主端）
    public function carOwner(Request $request)
    {
        //产品中心下的分类
        /*$postData['pid'] = 3;
        $classlist = $this->appLayerExec(ApiArticleClassify::class, 'assignClass', $postData);*/
        //分类下的文章详情（货主 车主）
        $goods['cid'] = 9;
        $goodsinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $goods);
        $car['cid'] = 10;
        $carinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $car);
        return view('enterprise.carOwner',['goodsinfo'=>$goodsinfo['res'],'carinfo'=>$carinfo['res']]);

    }
    //司机端
    public function motorman(Request $request)
    {
        $goods['cid'] = 9;
        $goodsinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $goods);
        $car['cid'] = 10;
        $carinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $car);
        return view('enterprise.motorman',['goodsinfo'=>$goodsinfo['res'],'carinfo'=>$carinfo['res']]);

    }
    //相关产品
    public function relatedProducts(Request $request)
    {
        $goods['cid'] = 9;
        $goodsinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $goods);
        $car['cid'] = 10;
        $carinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $car);
        return view('enterprise.relatedProducts',['goodsinfo'=>$goodsinfo['res'],'carinfo'=>$carinfo['res']]);

    }
    //大数据产业
    public function bigData(Request $request)
    {
        $goods['cid'] = 9;
        $goodsinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $goods);
        $car['cid'] = 10;
        $carinfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $car);
        return view('enterprise.bigData',['goodsinfo'=>$goodsinfo['res'],'carinfo'=>$carinfo['res']]);

    }
    //品牌专营
    public function brand(Request $request)
    {

        return view('enterprise.brand');

    }
    //新闻中心（公司动态）
    public function pressCenter(Request $request)
    {
        //公司动态下文章
        $data1['cid'] = 13;
        $list1 = $this->appLayerExec(ApiArticle::class, 'articleList', $data1);
        //行业新闻下文章
        $data2['cid'] = 14;
        $list2 = $this->appLayerExec(ApiArticle::class, 'articleList', $data2);
        //媒体新闻下文章
        $data3['cid'] = 15;
        $list3 = $this->appLayerExec(ApiArticle::class, 'articleList', $data3);
        //货满仓印象下文章
        $data4['cid'] = 16;
        $list4 = $this->appLayerExec(ApiArticle::class, 'articleList', $data4);
        return view('enterprise.pressCenter',['list1'=>$list1['res'],'list2'=>$list2['res'],'list3'=>$list3['res'],'list4'=>$list4['res']]);

    }
    //行业新闻
    public function industrynew(Request $request)
    {
        //公司动态下文章
        $data1['cid'] = 13;
        $list1 = $this->appLayerExec(ApiArticle::class, 'articleList', $data1);
        //行业新闻下文章
        $data2['cid'] = 14;
        $list2 = $this->appLayerExec(ApiArticle::class, 'articleList', $data2);
        //媒体新闻下文章
        $data3['cid'] = 15;
        $list3 = $this->appLayerExec(ApiArticle::class, 'articleList', $data3);
        //货满仓印象下文章
        $data4['cid'] = 16;
        $list4 = $this->appLayerExec(ApiArticle::class, 'articleList', $data4);
        return view('enterprise.industrynew',['list1'=>$list1['res'],'list2'=>$list2['res'],'list3'=>$list3['res'],'list4'=>$list4['res']]);

    }
    //媒体新闻
    public function medianew(Request $request)
    {
        //公司动态下文章
        $data1['cid'] = 13;
        $list1 = $this->appLayerExec(ApiArticle::class, 'articleList', $data1);
        //行业新闻下文章
        $data2['cid'] = 14;
        $list2 = $this->appLayerExec(ApiArticle::class, 'articleList', $data2);
        //媒体新闻下文章
        $data3['cid'] = 15;
        $list3 = $this->appLayerExec(ApiArticle::class, 'articleList', $data3);
        //货满仓印象下文章
        $data4['cid'] = 16;
        $list4 = $this->appLayerExec(ApiArticle::class, 'articleList', $data4);
        return view('enterprise.medianew',['list1'=>$list1['res'],'list2'=>$list2['res'],'list3'=>$list3['res'],'list4'=>$list4['res']]);

    }
    //货满仓印象
    public function Shipmentnew(Request $request)
    {
        //公司动态下文章
        $data1['cid'] = 13;
        $list1 = $this->appLayerExec(ApiArticle::class, 'articleList', $data1);
        //行业新闻下文章
        $data2['cid'] = 14;
        $list2 = $this->appLayerExec(ApiArticle::class, 'articleList', $data2);
        //媒体新闻下文章
        $data3['cid'] = 15;
        $list3 = $this->appLayerExec(ApiArticle::class, 'articleList', $data3);
        //货满仓印象下文章
        $data4['cid'] = 16;
        $list4 = $this->appLayerExec(ApiArticle::class, 'articleList', $data4);
        return view('enterprise.Shipmentnew',['list1'=>$list1['res'],'list2'=>$list2['res'],'list3'=>$list3['res'],'list4'=>$list4['res']]);


    }
    //人才中心
    public function talents(Request $request)
    {
        //人才中心下的分类
        $postData['pid'] = 6;
        $classlist = $this->appLayerExec(ApiArticleClassify::class, 'assignClass', $postData);
        //文章列表
        $data['status'] = 1;
        $list = $this->appLayerExec(ApiArticle::class, 'list', $data);

        return view('enterprise.talents',['classlist'=>$classlist['res'],'list'=>$list['res']]);


    }
    //联系我们
    public function connect(Request $request)
    {
        $postData['cid'] = 22;
        $info = $this->appLayerExec(ApiArticle::class, 'assignInfo', $postData);
        return view('enterprise.connect',['info'=>$info['res']]);

    }
    //文章详情
    public function articleInfo($id){

        $_where['status'] = 1;
        $_where['release_status'] = 1;
        $_where['id'] = $id;
        $articleinfo = Article::where($_where)->select()->first();
        return view('enterprise.subpage',['articleinfo'=>$articleinfo]);
    }

}